<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;

class CreateLogEarningsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('log_earnings', function(Blueprint $table)
		{
			$table->increments('id');
			$table->integer('agent_id')->comment('代理id');
			$table->integer('plat_id')->comment('平台id');
			$table->integer('site_id')->comment('网站id');
			$table->integer('site_score_id')->comment('网站加分id');
			$table->decimal('rate', 4, 3)->unsigned()->default(0.000)->comment('分红比率');
			$table->decimal('money', 13, 3)->unsigned()->default(0.000)->comment('购买金额');
			$table->decimal('site_rate', 13, 3)->unsigned()->default(0.000)->comment('网站比率');
			$table->decimal('score', 13, 3)->unsigned()->default(0.000)->comment('购买分数');
			$table->decimal('plat_rate', 13, 3)->unsigned()->default(0.000)->comment('平台比率');
			$table->decimal('earnings_money', 13, 3)->unsigned()->default(0.000)->comment('代理收益');
			$table->decimal('sys_earnings_money', 13, 3)->unsigned()->default(0.000)->comment('系统收益');
			$table->decimal('sys_net_earnings_money', 13, 3)->unsigned()->default(0.000)->comment('系统净收益');
			$table->decimal('before_money', 13, 3)->unsigned()->default(0.000)->comment('得到收益前代理余额');
			$table->decimal('after_money', 13, 3)->unsigned()->default(0.000)->comment('得到收益后代理余额');
			$table->timestamps();
		});
	}


	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('log_earnings');
	}

}
